<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
	<meta charset="utf-8" />
		<title>海船公司固定附加费</title>		
		
			<script type="text/javascript" src="plugins/websocketInstantMsg/ext4/ext-all-debug.js"></script>
			<script type="text/javascript" src="static/js/jquery-1.7.2.js" />
			<script type="text/javascript" src="plugins/websocketInstantMsg/ext4/locale/ext-lang-zh_CN.js"></script>
			<link rel="stylesheet" href="plugins/websocketInstantMsg/ext4/resources/css/ext-all.css" />
</head>
<body class="no-skin">
<div id="grid"></div>
</body>
<script type="text/javascript">
Ext.onReady(function(){
	Ext.QuickTips.init();
	var selModel = Ext.create('Ext.selection.CheckboxModel',{checkOnly:false});
	  var columns = [ 
					{text:'ID',dataIndex:'ID',hidden:true},
					{text:'检索码',dataIndex:'SEARCH_CODE'}, 
	                 {text:'船公司',dataIndex:'BOAT_COMPANY'}, //sortable:true 可设置是否为该列进行排序  
	                 {text:'航线名称',dataIndex:'ROUTE_NAME'},  
	                 {text:'结算单位',dataIndex:'SETTLE_UNIT'}, 
	                 {text:'费用名称',dataIndex:'FEE_NAME'}, 
	                 {text:'费用价格',dataIndex:'FEE_PRICE'}, 
	                 {text:'币种类型',dataIndex:'CURRENCY_TYPE'}, 
	                 {text:'计费标准',dataIndex:'CHARG_STANDARD'}, 
	                 {text:'箱型',dataIndex:'BOX_TYPE'}, 
	                 {text:'备注',dataIndex:'REMARK'}, 
	                 {text:'是否可用',dataIndex:'ENABLE'}, 
	                 {text:'公司代码',dataIndex:'COMPANY_CODE'}, 
	                 {text:'开始时间',dataIndex:'START_PRICE_TIME'}, 
	                 {text:'结束时间',dataIndex:'END_PRICE_TIME'}, 
	               ]; 
	  Ext.define('store', {
			extend : 'Ext.data.Model',
			fields :[  
				   {
	   		name:'ID'
	   	},  {
	   	    name: 'SEARCH_CODE'
	   	},{
	   	    name : 'BOAT_COMPANY'
	   	},{
	   	    name : 'ROUTE_NAME'
	   	},{
	   	    name : 'SETTLE_UNIT'
	   	},{
	   	    name : 'FEE_NAME'
	   	},{
	   	    name : 'FEE_PRICE'
	   	},{
	   	    name : 'CURRENCY_TYPE'
	   	},{
	   	    name : 'CHARG_STANDARD'
	   	},{
	   	    name : 'BOX_TYPE'
	   	},{
	   	    name : 'REMARK'
	   	},{
	   	    name : 'ENABLE'
	   	},{
	   	    name : 'COMPANY_CODE'
	   	},{
	   	    name : 'START_PRICE_TIME'
	   	},{
	   	    name : 'END_PRICE_TIME'
	   	}
				]
		});
	  var store = Ext.create('Ext.data.Store', {
			model : 'store',
			pageSize:10,
//			pageSize : thePageSize,
			id:'store',
			
			proxy : {
				type : 'ajax',
				actionMethods : {
					read : 'POST'
				},//将提交方式改为post
				url : '<%=basePath%>boatCompanyFixedSurcharge/BoatCompanyFixedSurchargeInfo',
				reader : {
					type : 'json',
					root : 'root',totalProperty:'total'
				}
			}
		});
	  var store1 = Ext.create('Ext.data.Store', {
			model : 'store1',
			pageSize:10,
//			pageSize : thePageSize,
			id:'store1',
			fields: ['BOX_TYPE_NAME'],
			proxy : {
				type : 'ajax',
				actionMethods : {
					read : 'POST'
				},//将提交方式改为post
				url : '<%=basePath%>boatCompanyFixedSurcharge/findBoxType',
				reader : {
					type : 'json',
					root : 'root1',totalProperty:'total'
				}
			}
		});
	  var store2 = Ext.create('Ext.data.Store', {
			model : 'store2',
			pageSize:10,
//			pageSize : thePageSize,
			id:'store2',
			fields: ['ROUTE_NAME'],
			proxy : {
				type : 'ajax',
				actionMethods : {
					read : 'POST'
				},//将提交方式改为post
				url : '<%=basePath%>boatCompanyFixedSurcharge/findRoute',
				reader : {
					type : 'json',
					root : 'root2',totalProperty:'total'
				}
			}
		});
	  var store3 = Ext.create('Ext.data.Store', {
			model : 'store3',
			pageSize:10,
//			pageSize : thePageSize,
			id:'store3',
			fields: ['FEE_NAME'],
			proxy : {
				type : 'ajax',
				actionMethods : {
					read : 'POST'
				},//将提交方式改为post
				url : '<%=basePath%>boatCompanyFixedSurcharge/findFee',
				reader : {
					type : 'json',
					root : 'root3',totalProperty:'total'
				}
			}
		});
	  var store4 = Ext.create('Ext.data.Store', {
			model : 'store4',
			pageSize:10,
//			pageSize : thePageSize,
			id:'store4',
			fields: ['SETTLE_COMPANY'],
			
			proxy : {
				type : 'ajax',
				actionMethods : {
					read : 'POST'
				},//将提交方式改为post
				url : '<%=basePath%>boatCompanyFixedSurcharge/findBoatCompanyAndUnit',
				reader : {
					type : 'json',
					root : 'root4',totalProperty:'total'
				}
			}
		});
	  store.load({ params:{start : 0,limit : 10}}); 
	//日期控件    
// 	    function convertDate(val) {
// 				return Ext.util.Format.date(new Date(val), 'Y-m-d');
// 			}
	  var paging = new Ext.PagingToolbar(
				{
					store : store,
					 pageSize:10,
					displayInfo : true,
					displayMsg : '<span style="color:blue;">第{0}条</span>至<span style="color:blue;">{1}条</span>，共<span style="color:blue;">{2}</span>条记录',
					emptyMsg : '无记录'
				});
		var tradeTypeStore = Ext.create('Ext.data.Store', {
			fields: ['id', 'name'],
			data : [
				{"id":"1", "name":"是"},
				{"id":"0", "name":"否"}
			]
		});
		var bizhong = Ext.create('Ext.data.Store', {
			fields: ['id', 'name'],
			data : [
				{"id":"1", "name":"RMB"},
				{"id":"2", "name":"USD"}
			]
		});
		var find =new Ext.Button({
			text: '查询',
			listeners: {
		         'click': function () {
		        	 var win = Ext.create("Ext.window.Window", {
			 				title: "查询",
			 				modal:true,
			 				/*width: 800,
			 				height: 360,*/
			 				maximizable: true,
			 				closeAction:'destroy',
			 				layout: "fit",
//			  				margin: '3 3 0',
			 		        buttonAlign:'center',
			 				items: [
			 				        	{
			 				        		xtype: "form",
			 				        		id:'form',
			 				        		bodyPadding: 5,
			 				        		layout: "hbox",
			 				        		defaults: {
			 				        			border: true,
			 				        			flex: 1,
			 				        			anchor: '100%'
			 				        		},
			 				        		fieldDefaults: {
			 				        			labelWidth: 92,
			 				        			labelAlign: "right",
			 				        			//flex: 1,
			 				        			margin: 5,
			 				        			labelStyle: 'color:green;'
			 				        		},
			 				        		items: [{
		       					        		xtype: 'textfield',
		       					        		name: 'BOAT_COMPANY',
		       					        		fieldLabel: '船公司',
		       					        	},{
		       					        		xtype: 'textfield',
		       					        		name: 'ROUTE_NAME',
		       					        		fieldLabel: '航线名称',
		       					        	},{
		       					        		xtype: 'textfield',
		       					        		name: 'FEE_NAME',
		       					        		fieldLabel: '费用名称',
		       					        	},
		       					        	{
		       					        		xtype: 'datefield',
		       					        		name: 'START_PRICE_TIME',
		       					        		fieldLabel: '开始时间',
		       					        		emptyText: "--请选择--",
		       					        	},
		       					        	{
		       					        		xtype: 'datefield',
		       					        		name: 'END_PRICE_TIME',
		       					        		fieldLabel: '结束时间',
		       					        		emptyText: "--请选择--",
		       					        	},
		       					        	]
			 				        	}
			 				        ],
			 				       buttons: [{
	     		       		            text: '查询',
	     		       		            handler: function(){
	     		       		            var form = Ext.getCmp('form').getForm();
	     		       		        
	     		       		
// 	     		       		            var BOAT_COMPANY = Ext.getCmp('BOAT_COMPANY').getValue();
// 	     					      		var ROUTE_NAME = Ext.getCmp('ROUTE_NAME').getValue();
// 	     					      		var FEE_NAME = Ext.getCmp('FEE_NAME').getValue();
	     						var store = Ext.getCmp('grid').getStore();
	     						store.on('beforeload', function(store,options) {  
	     					            var new_params = {  
// 	     					            		BOAT_COMPANY : BOAT_COMPANY, ROUTE_NAME:ROUTE_NAME,FEE_NAME:FEE_NAME
	     					            		BOAT_COMPANY:form.findField('BOAT_COMPANY').value,
	     					            		ROUTE_NAME:form.findField('ROUTE_NAME').value,
	     					            		FEE_NAME:form.findField('FEE_NAME').value,
	     					            		START_PRICE_TIME :form.findField('START_PRICE_TIME').value,	     					            		
	     					            		END_PRICE_TIME :form.findField('END_PRICE_TIME').value,
	     					            };  
	     						//这里apply一下实现新的proxy  
	     					            Ext.apply(store.proxy.extraParams,new_params);  
	     					        });  
	     						//对store重新载入  
	     					        store.load(); 
	     					       win.close();
	     		       		            }
	     		       		        },{
	     		       		            text: '关闭',
	     		       		            handler: function(){
	     		       		            	win.close();
	     		       		            }
	     		       		        }]
			 			});
		        	 win.show();
		         }
			}
		});
		var add =new Ext.Button({
			text: '新增',
			listeners: {
				'click': function () {
					 var win1 = Ext.create("Ext.window.Window", {
						 	title: "新增",
			 				modal:true,
			 				width: 700,
			 				height: 200,
			 				maximizable: true,
			 				closeAction:'destroy',
			 				layout: "fit",
//			  				margin: '3 3 0',
			 		        buttonAlign:'center',
			 				items: [
			 				        	{
			 				        		xtype: "form",
			 				        		id:'addform',
// 			 				        		bodyPadding: 5,
			 				        		layout: "column",
			 				        		defaults: {
			 				        			border: true,
			 				        			flex: 1,
			 				        			anchor: '100%'
			 				        		},
			 				        		fieldDefaults: {
			 				        			labelWidth: 92,
			 				        			labelAlign: "right",
			 				        			//flex: 1,
			 				        			margin: 5,
			 				        			labelStyle: 'color:green;'
			 				        		},
			 				        		items: [{
			 				        			columnWidth:.33,    
												layout: "form",
												 items:[
												{
												 	
													    xtype: "textfield",
														name: 'ID',
// 														fieldLabel: 'ID',
														hidden:true

													},
			 				        		        {
			 				        		        	
			 				        		    xtype: "combobox",
		       					        		name: 'BOAT_COMPANY',
		       					        		fieldLabel: '船公司',
		       					        		store:store4,
		       					        		displayField: "SETTLE_COMPANY",
		       					        		emptyText: "--请选择--",
		       					        	},{
		       					        		xtype: "combobox",
		       					        		name: 'ROUTE_NAME',
		       					        		fieldLabel: '航线名称',
		       					        		store:store2,
		       					        		displayField: "ROUTE_NAME",
		       					        		emptyText: "--请选择--",
		       					        	},{
		       					        		xtype: "combobox",
		       					        		name: 'SETTLE_UNIT',
		       					        		fieldLabel: '结算单位',
		       					        		store:store4,
		       					        		displayField: "SETTLE_COMPANY",
		       					        		emptyText: "--请选择--",
		       					        	},{
		       					        		xtype: 'textfield',
		       					        		name: 'FEE_NAME',
		       					        		store:store3,
		       					        		displayField: "FEE_NAME",
		       					        		fieldLabel: '费用名称',
		       					        	},
		       					        	{
		       					     		xtype: 'datefield',
		       					     		name: 'START_PRICE_TIME',
		       					     		fieldLabel: '开始时间',
		       						        emptyText:'请选择',
	       					 		        editable: false,
	       					 		       allowBlank: false
		       					     	},
		       					        	]},{
		       					        		columnWidth:.33,
		       					        		layout: "form",
		       					        		items:[
		       					        	{
		       					        		xtype: 'textfield',
		       					        		name: 'FEE_PRICE',
		       					        		fieldLabel: '费用价格',
		       					        	},{
		       					        		xtype: "combobox",
		       					        		name: 'CURRENCY_TYPE',
		       					        		fieldLabel: '币种类型',
		       					        		store:bizhong,
		       					        	 	displayField: "name",
		       					        		emptyText: "--请选择--",
		       					        	},{
		       					        		xtype: 'textfield',
		       					        		name: 'CHARG_STANDARD',
		       					        		fieldLabel: '计费标准',
		       					        	},{
		       					        		xtype: "combobox",
		       					        		name: 'BOX_TYPE',
		       					        		store:store1,
		       					        		fieldLabel: '箱型',
		       					        		displayField: "BOX_TYPE_NAME",
		       					        		emptyText: "--请选择--",
		       					        	},{
		       					     		   xtype: 'datefield',
		       					 		       name: 'END_PRICE_TIME',
		       					 		       fieldLabel: '结束时间',
		       					 		       emptyText:'请选择',
		       					 		       editable: false,
		       					 		       allowBlank: false,
		       					 		    
		       					 	         }]},{
		       					        		columnWidth:.33,
		       					        		layout: "form",
		       					        		items:[
										{
												xtype: 'textfield',
												name: 'REMARK',
												fieldLabel: '备注',
											},
		       					        	{
												xtype: "combobox",
		       					        		name: 'ENABLE',
		       					        		fieldLabel: '是否可用',
		       					        		emptyText: "--请选择--",
		       					        		displayField: "name",
		       					        		valueField:'id',
		       					        		store:tradeTypeStore
		       					        	},{
		       					        		xtype: 'textfield',
		       					        		name: 'SEARCH_CODE',
		       					        		fieldLabel: '检索码',
		       					        	},{
		       					        		xtype: 'textfield',
		       					        		name: 'COMPANY_CODE',
		       					        		fieldLabel: '公司代码',
		       					        	},]},
		       					        	
		       					        	
		       					        	]
			 				        	}
			 				        ],
			 				       buttons: [{
	     		       		            text: '保存',
	     		       		            handler: function(){
	     		       		            	var form = Ext.getCmp('addform').getForm();
	     		       		            if (form.isValid()) {
	     		       		            	form.submit({
	     		       		            		params:{
	     		       		            		},
	     		       		            		waitTitle : '请稍后...',  
	     		       		            		waitMsg : '正在保存信息,请稍后...',  
	     		       		            		url:'<%=basePath%>boatCompanyFixedSurcharge/saveInfo',
						          				success:function(form,action){
						          					Ext.Msg.alert("提示","保存成功");
						          					store.load();
						          					win1.close();
						          				},

						          			});
	     		       		            
	     		       		            }else{
	     		       		            Ext.Msg.alert("提示","开始,结束时间不能为空");
	     		       		            }
	     		       		            	}
	     		       		            
	     		       		        },{
	     		       		            text: '关闭',
	     		       		            handler: function(){
	     		       		            	win1.close();
	     		       		            }
	     		       		        }]
					 });
					 win1.show();
				}
			}
			
		});
		var update =new Ext.Button({
			text: '编辑',
			listeners: {
				'click': function () {
					var records = grid.getSelectionModel().getSelection();
					if(records.length==0){
  		       			Ext.Msg.alert("提示","请选择需要编辑的记录");return;
  		       		}
  		       		if(records.length>1){
  		       			Ext.Msg.alert("提示","只能编辑一条记录");return;
  		       		}
					var win2 = Ext.create("Ext.window.Window", {
					 	title: "新增",
		 				modal:true,
		 				width: 700,
		 				height: 200,
		 				maximizable: true,
		 				closeAction:'destroy',
		 				layout: "fit",
//		  				margin: '3 3 0',
		 		        buttonAlign:'center',
		 				items: [
		 				        	{
		 				        		xtype: "form",
		 				        		id:'addform',
//			 				        		bodyPadding: 5,
		 				        		layout: "column",
		 				        		defaults: {
		 				        			border: true,
		 				        			flex: 1,
		 				        			anchor: '100%'
		 				        		},
		 				        		fieldDefaults: {
		 				        			labelWidth: 92,
		 				        			labelAlign: "right",
		 				        			//flex: 1,
		 				        			margin: 5,
		 				        			labelStyle: 'color:green;'
		 				        		},
		 				        		items: [{
		 				        			columnWidth:.33,    
											layout: "form",
											 items:[
											{
											 	
												    xtype: "textfield",
													name: 'ID',
//														fieldLabel: 'ID',
													value:records[0].data.ID,
													hidden:true

												},
		 				        		        {
		 				        		        	
		 				        		    xtype: "combobox",
	       					        		name: 'BOAT_COMPANY',
	       					        		fieldLabel: '船公司',
	       					        		store:store4,
	       					        		displayField: "SETTLE_COMPANY",
	       					        		value:records[0].data.BOAT_COMPANY,
	       					        		emptyText: "--请选择--",
	       					        	},{
	       					        		xtype: "combobox",
	       					        		name: 'ROUTE_NAME',
	       					        		fieldLabel: '航线名称',
	       					        		store:store2,
	       					        		displayField: "ROUTE_NAME",
	       					        		value:records[0].data.ROUTE_NAME,
	       					        		emptyText: "--请选择--",
	       					        	},{
	       					        		xtype: "combobox",
	       					        		name: 'SETTLE_UNIT',
	       					        		fieldLabel: '结算单位',
	       					        		store:store4,
	       					        		displayField: "SETTLE_COMPANY",
	       					        		value:records[0].data.SETTLE_UNIT,
	       					        		emptyText: "--请选择--",
	       					        	},{
	       					        		xtype: 'textfield',
	       					        		name: 'FEE_NAME',
	       					        		store:store3,
	       					        		displayField: "FEE_NAME",
	       					        		value:records[0].data.FEE_NAME,
	       					        		fieldLabel: '费用名称',
	       					        	},{
	       					        		xtype: 'datefield',
	       					        		name: 'START_PRICE_TIME',       					       
	       					        		value:records[0].data.START_PRICE_TIME,
	       					        		fieldLabel: '开始时间',
	       					        		editable: false,
	       					        		allowBlank: false
	       					        	},]},{
	       					        		columnWidth:.33,
	       					        		layout: "form",
	       					        		items:[
	       					        	{
	       					        		xtype: 'textfield',
	       					        		name: 'FEE_PRICE',
	       					        		fieldLabel: '费用价格',
	       					        		value:records[0].data.FEE_PRICE,
	       					        	},{
	       					        		xtype: "combobox",
	       					        		name: 'CURRENCY_TYPE',
	       					        		fieldLabel: '币种类型',
	       					        		value:records[0].data.CURRENCY_TYPE,
	       					        		store:bizhong,
	       					        	 	displayField: "name",
	       					        		emptyText: "--请选择--",
	       					        	},{
	       					        		xtype: 'textfield',
	       					        		name: 'CHARG_STANDARD',
	       					        		fieldLabel: '计费标准',
	       					        		value:records[0].data.CHARG_STANDARD,
	       					        	},{
	       					        		xtype: "combobox",
	       					        		name: 'BOX_TYPE',
	       					        		store:store1,
	       					        		fieldLabel: '箱型',
	       					        		displayField: "BOX_TYPE_NAME",
	       					        		value:records[0].data.BOX_TYPE,
	       					        		emptyText: "--请选择--",
	       					        	},{
	       					        		xtype: 'datefield',
	       					        		name: 'END_PRICE_TIME',       					       
	       					        		value:records[0].data.END_PRICE_TIME,
	       					        		fieldLabel: '结束时间',
	       					        		editable: false,
	       					        		allowBlank: false
	       					        	},]},{
	       					        		columnWidth:.33,
	       					        		layout: "form",
	       					        		items:[
									{
											xtype: 'textfield',
											name: 'REMARK',
											value:records[0].data.REMARK,
											fieldLabel: '备注',
										},
	       					        	{
											xtype: "combobox",
	       					        		name: 'ENABLE',
	       					        		fieldLabel: '是否可用',
	       					        		value:records[0].data.ENABLE,
	       					        		emptyText: "--请选择--",
	       					        		displayField: "name",
	       					        		valueField:'id',
	       					        		store:tradeTypeStore
	       					        	},{
	       					        		xtype: 'textfield',
	       					        		name: 'SEARCH_CODE',
	       					        		value:records[0].data.SEARCH_CODE,
	       					        		fieldLabel: '检索码',
	       					        	},{
	       					        		xtype: 'textfield',
	       					        		name: 'COMPANY_CODE',
	       					        		value:records[0].data.COMPANY_CODE,
	       					        		fieldLabel: '公司代码',
	       					        	}]}]
		 				        	}
		 				        ],
		 				       buttons: [{
     		       		            text: '保存',
     		       		            handler: function(){
     		       		            	var form = Ext.getCmp('addform').getForm();
     		       		            	if(form.isValid()){
     		       		            	form.submit({
     		       		            		params:{
     		       		            		},
     		       		            		waitTitle : '请稍后...',  
     		       		            		waitMsg : '正在保存信息,请稍后...',  
     		       		            		url:'<%=basePath%>boatCompanyFixedSurcharge/saveInfo',
					          				success:function(form,action){
					          					Ext.Msg.alert("提示","保存成功");
					          					store.load();
					          					win2.close();
					          				},

					          			});

     		       		            }else{
     		       		            Ext.Msg.alert("提示","开始,结束时间不能为空");
     		       		            	}
     		       		            }
     		       		        },{
     		       		            text: '关闭',
     		       		            handler: function(){
     		       		            	//alert("00")
     		       		            	win2.close();
     		       		            }
     		       		        }]
				 });
					win2.show();
				}
			}
		});
		
		var deleteInfo =new Ext.Button({
			text: '删除',
			listeners: {
				'click': function () {
					var records = grid.getSelectionModel().getSelection();
					if(records.length==0){
  		       			Ext.Msg.alert("提示","请选择需要删除的记录");return;
  		       		}
					var arr = [];
	       			Ext.each(records,function(item){
	       				obj = {
	       						id:item.data.ID
	       				};
	       				arr.push(obj);
	       			});
	       			var array = JSON.stringify(arr);
	       			Ext.Msg.confirm("提示","确定删除数据?",function(btn){
		       				
		       					Ext.Ajax.request({
		       						url:'<%=basePath%>boatCompanyFixedSurcharge/deleteInfo',
		       						params:{
		       							array:array
		       						},
		       						timeout:5000,
		       						success:function(response){
		       							store.load();
		       							Ext.Msg.alert("成功","删除成功!");
		       						},
		       						failure:function(response){
		       							Ext.Msg.alert("错误","请求异常!");
		       						}
		       					});
		       				
		       			});
				}
			}
		});
		var edit =new Ext.Button({
			text: '批量修改结算单位',
			listeners: {
				'click': function () {
					var records = grid.getSelectionModel().getSelection();
					if(records.length==0){
  		       			Ext.Msg.alert("提示","请选择需要修改结算单位的记录");return;
  		       		}
					
					var arr = [];
	       			Ext.each(records,function(item){
	       				var SETTLE_UNIT = Ext.getCmp('tt').getValue();
	       				obj = {
	       						id:item.data.ID,
	       						SETTLE_UNIT:SETTLE_UNIT,
	       				};
	       				arr.push(obj);
	       			});
	       			var array = JSON.stringify(arr);
		       				
		       					Ext.Ajax.request({
		       						url:'<%=basePath%>boatCompanyFixedSurcharge/updateInfo',
		       						params:{
		       							array:array
		       						},
		       						timeout:5000,
		       						success:function(response){
		       							store.load();
		       						},
		       						failure:function(response){
		       							Ext.Msg.alert("错误","请求异常!");
		       						}
		       					});
		       				
				}
			}
		});
		var grid = new Ext.grid.GridPanel({
			//collapsible :true,
		    //split: true,
		    title:"海船公司固定附加费用",
		    width:'100%',
		    store:store,
		    forceFit:true,
		    columns:columns,
		    id:'grid',
		    selModel:selModel,
		    columnLines: true,
		    menuDisabled:true,
		     bbar : paging,
		     tbar: [find,add,update,deleteInfo,{width:250,labelWidth:80,displayField: "SETTLE_COMPANY",id:"tt",xtype:'combobox',store:store4},edit,{text: '导出', icon: '<%=basePath%>plugins/websocketInstantMsg/ext4/shared/icons/fam/folder_go.gif', handler: function (){
				 var records = grid.getSelectionModel().getSelection();
			   	 if(records.length==0){
			     			Ext.Msg.alert("提示","请选择一条记录导出");return;
			     		}
			     		if(records.length>1){
			     			Ext.Msg.alert("提示","只能选择一条记录导出");return;
			     		}
			     		
				document.location.href="<%=basePath%>common/export/exportExcel?exportType="+"boatCompanyFixed"+"&ID="+records[0].data.ID;
			}
			},{text: '导入', icon: '<%=basePath%>plugins/websocketInstantMsg/ext4/shared/icons/fam/control_rewind.png', 
				handler:
				 toImport
			
			},],
		    viewConfig:{enableTextSelection:true,stripeRows: true},
		    renderTo:'grid',
		});
		
		
		
		
		  var uploadForm = Ext.create('Ext.form.Panel', {
			    items: [
			        {
			            xtype: 'filefield',
			            fieldLabel: '文件上传',
			            name:"file",
			            labelWidth: 80,
			            msgTarget: 'side',
			            allowBlank: false,
			            emptyText: "请选择上传文件",
			            blankText:"请选择上传文件",
			            margin: '10,10,10,10',
			            anchor: '100%',
			            buttonText:'选择文件'
			        }],
			    buttonAlign:'center'

			});


			var impWin = Ext.create('Ext.window.Window', {
			    title: '海船公司固定附加费用',
			    modal : true,
			    items: [uploadForm],
			    closeAction: 'hide',
			    closeable: true,
			    iconCls: 'modalWin',
			    buttonAlign: 'center',
			    buttons: [
			        {text: '导入',handler: function() { impSubmit(); }},
			        {text: '关闭', handler: function() { impWin.close(); }},
			        {text: '下载模板', handler: function() { impWinxiazai(); }}
			    ]
			});

			function impSubmit(){
			    uploadForm.getForm().submit({
			        url: '<%=basePath%>boatCompanyFixedSurcharge/boatCompanyFixesInfo',
			        success: function(form, action) {
			        	Ext.Msg.alert("提示","导入成功！");
			        	store.load();  
			        	 impWin.close();
			        },
				failure: function(form, action){  
					Ext.Msg.alert("提示","导入失败！");
			    	store.load();  
			      }  
			    });
			}
			//下载模板
			function impWinxiazai(){
				document.location.href="<%=basePath%>boatCompanyFixedSurcharge/downExcel";	
	
			}
			function toImport(){
			    impWin.show();
			}
});

</script>
</html>